<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <!--日期选择-->
          <template >
            <a-col :xl="6" :lg="7" :md="6" :sm="24">
              <a-form-item label="时间区间"  >
                <a-range-picker @change="onChange" />
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="selectpro1" icon="search">查询</a-button>
              <a-button type="primary" @click="selectpro2" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <Bar title="柱状图" :dataSource="dataSource" :height="100"/>
  </a-card>
</template>

<script>
import Bar from '@/components/chart/Bar'
import {getAction} from '@/api/manage'
import '@/assets/less/TableExpand.less'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'

export default {
  name: "SreachList",
  mixins: [JeecgListMixin],
  components: { Bar},
  data () {
    return {
      queryParam: {
        beginDate:'',
        overDate:''
      },
      dataSource :[
      ],
    }

  },
  methods: {
    selectpro1() {
      var url = "/test123/jeecgDemo123/hello123";
      var params = this.queryParam;//查询条件
      getAction(url,params).then((res) => {
        if (res.success) {
          console.log("res" + JSON.stringify(res))
          this.dataSource = res.result;
        }
      })
    },
    selectpro2() {
      let url = "/test123/jeecgDemo123/hello1234";
      getAction(url).then((res) => {
        if (res.success) {
          this.dataSource = res.result;
        }
      })
    },
    onChange(date, dateString) {

      // 把值分别存储
      let beginDate = dateString[0]
      let overDate = dateString[1]
      // 把值放入queryParam中
      this.queryParam.beginDate = beginDate
      this.queryParam.overDate = overDate
    },

  },
  created() {
    this.selectpro2();
  }

}
</script>